﻿namespace Microsoft.SharePoint.Client
{
    using Microsoft.SharePoint.Client.Utilities;
    using Microsoft.SharePoint.Client.Workflow;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;

    [ScriptType("SP.Web", ServerTypeId="{a489add2-5d3a-4de8-9445-49259462dceb}")]
    public class Web : SecurableObject
    {
        [EditorBrowsable(EditorBrowsableState.Never)]
        public Web(ClientRuntimeContext Context, ObjectPath ObjectPath) : base(Context, ObjectPath)
        {
        }

        [Remote]
        public void ApplyWebTemplate(string strWebTemplate)
        {
            ClientAction query = new ClientActionInvokeMethod(this, "ApplyWebTemplate", new object[] { strWebTemplate });
            base.Context.AddQuery(query);
        }

        [Remote]
        public void DeleteObject()
        {
            ClientAction query = new ClientActionInvokeMethod(this, "DeleteObject", null);
            base.Context.AddQuery(query);
            base.RemoveFromParentCollection();
        }

        [Remote]
        public ClientResult<bool> DoesUserHavePermissions(BasePermissions permissionMask)
        {
            if (base.Context.ValidateOnClient && (permissionMask == null))
            {
                throw ClientUtility.CreateArgumentNullException("permissionMask");
            }
            ClientAction query = new ClientActionInvokeMethod(this, "DoesUserHavePermissions", new object[] { permissionMask });
            base.Context.AddQuery(query);
            ClientResult<bool> result = new ClientResult<bool>();
            base.Context.AddQueryIdAndResultObject(query.Id, result);
            return result;
        }

        [Remote]
        public User EnsureUser(string logonName)
        {
            return new User(base.Context, new ObjectPathMethod(base.Context, base.Path, "EnsureUser", new object[] { logonName }));
        }

        [Remote]
        public WebTemplateCollection GetAvailableWebTemplates(uint lcid, bool doIncludeCrossLanguage)
        {
            return new WebTemplateCollection(base.Context, new ObjectPathMethod(base.Context, base.Path, "GetAvailableWebTemplates", new object[] { lcid, doIncludeCrossLanguage }));
        }

        [Remote]
        public List GetCatalog(int typeCatalog)
        {
            Dictionary<int, List> dictionary;
            object obj2;
            if (base.ObjectData.MethodReturnObjects.TryGetValue("GetCatalog", out obj2))
            {
                dictionary = (Dictionary<int, List>) obj2;
            }
            else
            {
                dictionary = new Dictionary<int, List>();
                base.ObjectData.MethodReturnObjects["GetCatalog"] = dictionary;
            }
            List list = null;
            if (!dictionary.TryGetValue(typeCatalog, out list))
            {
                list = new List(base.Context, new ObjectPathMethod(base.Context, base.Path, "GetCatalog", new object[] { typeCatalog }));
                dictionary[typeCatalog] = list;
            }
            return list;
        }

        [Remote]
        public ChangeCollection GetChanges(ChangeQuery query_)
        {
            if (base.Context.ValidateOnClient && (query_ == null))
            {
                throw ClientUtility.CreateArgumentNullException("query_");
            }
            return new ChangeCollection(base.Context, new ObjectPathMethod(base.Context, base.Path, "GetChanges", new object[] { query_ }));
        }

        [Remote]
        public File GetFileByServerRelativeUrl(string serverRelativeUrl)
        {
            Dictionary<string, File> dictionary;
            object obj2;
            if (base.Context.ValidateOnClient)
            {
                if (serverRelativeUrl == null)
                {
                    throw ClientUtility.CreateArgumentNullException("serverRelativeUrl");
                }
                if ((serverRelativeUrl != null) && (serverRelativeUrl.Length == 0))
                {
                    throw ClientUtility.CreateArgumentException("serverRelativeUrl");
                }
            }
            if (base.ObjectData.MethodReturnObjects.TryGetValue("GetFileByServerRelativeUrl", out obj2))
            {
                dictionary = (Dictionary<string, File>) obj2;
            }
            else
            {
                dictionary = new Dictionary<string, File>(StringComparer.OrdinalIgnoreCase);
                base.ObjectData.MethodReturnObjects["GetFileByServerRelativeUrl"] = dictionary;
            }
            File file = null;
            if (!dictionary.TryGetValue(serverRelativeUrl, out file))
            {
                file = new File(base.Context, new ObjectPathMethod(base.Context, base.Path, "GetFileByServerRelativeUrl", new object[] { serverRelativeUrl }));
                dictionary[serverRelativeUrl] = file;
                ObjectIdentityQuery query = new ObjectIdentityQuery(file.Path);
                base.Context.AddQueryIdAndResultObject(query.Id, file);
                base.Context.AddQuery(query);
            }
            return file;
        }

        [Remote]
        public Folder GetFolderByServerRelativeUrl(string serverRelativeUrl)
        {
            Dictionary<string, Folder> dictionary;
            object obj2;
            if (base.Context.ValidateOnClient && (serverRelativeUrl == null))
            {
                throw ClientUtility.CreateArgumentNullException("serverRelativeUrl");
            }
            if (base.ObjectData.MethodReturnObjects.TryGetValue("GetFolderByServerRelativeUrl", out obj2))
            {
                dictionary = (Dictionary<string, Folder>) obj2;
            }
            else
            {
                dictionary = new Dictionary<string, Folder>(StringComparer.OrdinalIgnoreCase);
                base.ObjectData.MethodReturnObjects["GetFolderByServerRelativeUrl"] = dictionary;
            }
            Folder folder = null;
            if (!dictionary.TryGetValue(serverRelativeUrl, out folder))
            {
                folder = new Folder(base.Context, new ObjectPathMethod(base.Context, base.Path, "GetFolderByServerRelativeUrl", new object[] { serverRelativeUrl }));
                dictionary[serverRelativeUrl] = folder;
                ObjectIdentityQuery query = new ObjectIdentityQuery(folder.Path);
                base.Context.AddQueryIdAndResultObject(query.Id, folder);
                base.Context.AddQuery(query);
            }
            return folder;
        }

        [Remote]
        public WebCollection GetSubwebsForCurrentUser(SubwebQuery query_)
        {
            return new WebCollection(base.Context, new ObjectPathMethod(base.Context, base.Path, "GetSubwebsForCurrentUser", new object[] { query_ }));
        }

        internal void InitFromCreationInformation(WebCreationInformation creation)
        {
            if (creation != null)
            {
                base.ObjectData.Properties["Description"] = creation.Description;
                base.ObjectData.Properties["Title"] = creation.Title;
            }
        }

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag)
            {
                switch (peekedName)
                {
                    case "Lists":
                        flag = true;
                        reader.ReadName();
                        this.Lists.FromJson(reader);
                        return flag;

                    case "RootFolder":
                        flag = true;
                        reader.ReadName();
                        this.RootFolder.FromJson(reader);
                        return flag;

                    case "Folders":
                        flag = true;
                        reader.ReadName();
                        this.Folders.FromJson(reader);
                        return flag;

                    case "Webs":
                        flag = true;
                        reader.ReadName();
                        this.Webs.FromJson(reader);
                        return flag;

                    case "Features":
                        flag = true;
                        reader.ReadName();
                        this.Features.FromJson(reader);
                        return flag;

                    case "WorkflowTemplates":
                        flag = true;
                        reader.ReadName();
                        this.WorkflowTemplates.FromJson(reader);
                        return flag;

                    case "WorkflowAssociations":
                        flag = true;
                        reader.ReadName();
                        this.WorkflowAssociations.FromJson(reader);
                        return flag;

                    case "ListTemplates":
                        flag = true;
                        reader.ReadName();
                        this.ListTemplates.FromJson(reader);
                        return flag;

                    case "CurrentUser":
                        flag = true;
                        reader.ReadName();
                        this.CurrentUser.FromJson(reader);
                        return flag;

                    case "Description":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Description"] = reader.ReadString();
                        return flag;

                    case "Created":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Created"] = reader.ReadDateTime();
                        return flag;

                    case "LastItemModifiedDate":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["LastItemModifiedDate"] = reader.ReadDateTime();
                        return flag;

                    case "RecycleBinEnabled":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["RecycleBinEnabled"] = reader.ReadBoolean();
                        return flag;

                    case "Title":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Title"] = reader.ReadString();
                        return flag;

                    case "ServerRelativeUrl":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ServerRelativeUrl"] = reader.ReadString();
                        return flag;

                    case "Id":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Id"] = reader.ReadGuid();
                        return flag;

                    case "AllProperties":
                        flag = true;
                        reader.ReadName();
                        this.AllProperties.FromJson(reader);
                        return flag;

                    case "SyndicationEnabled":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["SyndicationEnabled"] = reader.ReadBoolean();
                        return flag;

                    case "AllowRssFeeds":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["AllowRssFeeds"] = reader.ReadBoolean();
                        return flag;

                    case "QuickLaunchEnabled":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["QuickLaunchEnabled"] = reader.ReadBoolean();
                        return flag;

                    case "TreeViewEnabled":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["TreeViewEnabled"] = reader.ReadBoolean();
                        return flag;

                    case "Language":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Language"] = reader.ReadUInt32();
                        return flag;

                    case "Navigation":
                        flag = true;
                        reader.ReadName();
                        this.Navigation.FromJson(reader);
                        return flag;

                    case "ContentTypes":
                        flag = true;
                        reader.ReadName();
                        this.ContentTypes.FromJson(reader);
                        return flag;

                    case "AvailableContentTypes":
                        flag = true;
                        reader.ReadName();
                        this.AvailableContentTypes.FromJson(reader);
                        return flag;

                    case "Fields":
                        flag = true;
                        reader.ReadName();
                        this.Fields.FromJson(reader);
                        return flag;

                    case "AvailableFields":
                        flag = true;
                        reader.ReadName();
                        this.AvailableFields.FromJson(reader);
                        return flag;

                    case "UserCustomActions":
                        flag = true;
                        reader.ReadName();
                        this.UserCustomActions.FromJson(reader);
                        return flag;

                    case "UIVersion":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["UIVersion"] = reader.ReadInt32();
                        return flag;

                    case "UIVersionConfigurationEnabled":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["UIVersionConfigurationEnabled"] = reader.ReadBoolean();
                        return flag;

                    case "AllowDesignerForCurrentUser":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["AllowDesignerForCurrentUser"] = reader.ReadBoolean();
                        return flag;

                    case "AllowRevertFromTemplateForCurrentUser":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["AllowRevertFromTemplateForCurrentUser"] = reader.ReadBoolean();
                        return flag;

                    case "AllowMasterPageEditingForCurrentUser":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["AllowMasterPageEditingForCurrentUser"] = reader.ReadBoolean();
                        return flag;

                    case "ShowUrlStructureForCurrentUser":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ShowUrlStructureForCurrentUser"] = reader.ReadBoolean();
                        return flag;

                    case "SiteUserInfoList":
                        flag = true;
                        reader.ReadName();
                        this.SiteUserInfoList.FromJson(reader);
                        return flag;

                    case "SiteGroups":
                        flag = true;
                        reader.ReadName();
                        this.SiteGroups.FromJson(reader);
                        return flag;

                    case "RoleDefinitions":
                        flag = true;
                        reader.ReadName();
                        this.RoleDefinitions.FromJson(reader);
                        return flag;

                    case "EffectiveBasePermissions":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["EffectiveBasePermissions"] = reader.Read<BasePermissions>();
                        return flag;

                    case "AssociatedOwnerGroup":
                        flag = true;
                        reader.ReadName();
                        this.AssociatedOwnerGroup.FromJson(reader);
                        return flag;

                    case "AssociatedMemberGroup":
                        flag = true;
                        reader.ReadName();
                        this.AssociatedMemberGroup.FromJson(reader);
                        return flag;

                    case "AssociatedVisitorGroup":
                        flag = true;
                        reader.ReadName();
                        this.AssociatedVisitorGroup.FromJson(reader);
                        return flag;
                }
            }
            return flag;
        }

        [Remote]
        public ClientResult<string> MapToIcon(string fileName, string progId, IconSize size)
        {
            ClientAction query = new ClientActionInvokeMethod(this, "MapToIcon", new object[] { fileName, progId, size });
            base.Context.AddQuery(query);
            ClientResult<string> result = new ClientResult<string>();
            base.Context.AddQueryIdAndResultObject(query.Id, result);
            return result;
        }

        [Remote]
        public void Update()
        {
            ClientAction query = new ClientActionInvokeMethod(this, "Update", null);
            base.Context.AddQuery(query);
        }

        [Remote]
        public bool AllowDesignerForCurrentUser
        {
            get
            {
                base.CheckUninitializedProperty("AllowDesignerForCurrentUser");
                return (bool) base.ObjectData.Properties["AllowDesignerForCurrentUser"];
            }
        }

        [Remote]
        public bool AllowMasterPageEditingForCurrentUser
        {
            get
            {
                base.CheckUninitializedProperty("AllowMasterPageEditingForCurrentUser");
                return (bool) base.ObjectData.Properties["AllowMasterPageEditingForCurrentUser"];
            }
        }

        [Remote]
        public bool AllowRevertFromTemplateForCurrentUser
        {
            get
            {
                base.CheckUninitializedProperty("AllowRevertFromTemplateForCurrentUser");
                return (bool) base.ObjectData.Properties["AllowRevertFromTemplateForCurrentUser"];
            }
        }

        [Remote]
        public bool AllowRssFeeds
        {
            get
            {
                base.CheckUninitializedProperty("AllowRssFeeds");
                return (bool) base.ObjectData.Properties["AllowRssFeeds"];
            }
        }

        [Remote]
        public PropertyValues AllProperties
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("AllProperties", out obj2))
                {
                    return (PropertyValues) obj2;
                }
                PropertyValues values = new PropertyValues(base.Context, new ObjectPathProperty(base.Context, base.Path, "AllProperties"));
                base.ObjectData.ClientObjectProperties["AllProperties"] = values;
                return values;
            }
        }

        [Remote]
        public Group AssociatedMemberGroup
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("AssociatedMemberGroup", out obj2))
                {
                    return (Group) obj2;
                }
                Group group = new Group(base.Context, new ObjectPathProperty(base.Context, base.Path, "AssociatedMemberGroup"));
                base.ObjectData.ClientObjectProperties["AssociatedMemberGroup"] = group;
                return group;
            }
            set
            {
                base.ObjectData.ClientObjectProperties["AssociatedMemberGroup"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "AssociatedMemberGroup", value));
                }
            }
        }

        [Remote]
        public Group AssociatedOwnerGroup
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("AssociatedOwnerGroup", out obj2))
                {
                    return (Group) obj2;
                }
                Group group = new Group(base.Context, new ObjectPathProperty(base.Context, base.Path, "AssociatedOwnerGroup"));
                base.ObjectData.ClientObjectProperties["AssociatedOwnerGroup"] = group;
                return group;
            }
            set
            {
                base.ObjectData.ClientObjectProperties["AssociatedOwnerGroup"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "AssociatedOwnerGroup", value));
                }
            }
        }

        [Remote]
        public Group AssociatedVisitorGroup
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("AssociatedVisitorGroup", out obj2))
                {
                    return (Group) obj2;
                }
                Group group = new Group(base.Context, new ObjectPathProperty(base.Context, base.Path, "AssociatedVisitorGroup"));
                base.ObjectData.ClientObjectProperties["AssociatedVisitorGroup"] = group;
                return group;
            }
            set
            {
                base.ObjectData.ClientObjectProperties["AssociatedVisitorGroup"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "AssociatedVisitorGroup", value));
                }
            }
        }

        [Remote]
        public ContentTypeCollection AvailableContentTypes
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("AvailableContentTypes", out obj2))
                {
                    return (ContentTypeCollection) obj2;
                }
                ContentTypeCollection types = new ContentTypeCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "AvailableContentTypes"));
                base.ObjectData.ClientObjectProperties["AvailableContentTypes"] = types;
                return types;
            }
        }

        [Remote]
        public FieldCollection AvailableFields
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("AvailableFields", out obj2))
                {
                    return (FieldCollection) obj2;
                }
                FieldCollection fields = new FieldCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "AvailableFields"));
                base.ObjectData.ClientObjectProperties["AvailableFields"] = fields;
                return fields;
            }
        }

        [Remote]
        public ContentTypeCollection ContentTypes
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("ContentTypes", out obj2))
                {
                    return (ContentTypeCollection) obj2;
                }
                ContentTypeCollection types = new ContentTypeCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "ContentTypes"));
                base.ObjectData.ClientObjectProperties["ContentTypes"] = types;
                return types;
            }
        }

        [Remote]
        public DateTime Created
        {
            get
            {
                base.CheckUninitializedProperty("Created");
                return (DateTime) base.ObjectData.Properties["Created"];
            }
        }

        [Remote]
        public User CurrentUser
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("CurrentUser", out obj2))
                {
                    return (User) obj2;
                }
                User user = new User(base.Context, new ObjectPathProperty(base.Context, base.Path, "CurrentUser"));
                base.ObjectData.ClientObjectProperties["CurrentUser"] = user;
                return user;
            }
        }

        [Remote]
        public string Description
        {
            get
            {
                base.CheckUninitializedProperty("Description");
                return (string) base.ObjectData.Properties["Description"];
            }
            set
            {
                base.ObjectData.Properties["Description"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "Description", value));
                }
            }
        }

        [Remote]
        public BasePermissions EffectiveBasePermissions
        {
            get
            {
                base.CheckUninitializedProperty("EffectiveBasePermissions");
                return (BasePermissions) base.ObjectData.Properties["EffectiveBasePermissions"];
            }
        }

        [Remote]
        public FeatureCollection Features
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("Features", out obj2))
                {
                    return (FeatureCollection) obj2;
                }
                FeatureCollection features = new FeatureCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "Features"));
                base.ObjectData.ClientObjectProperties["Features"] = features;
                return features;
            }
        }

        [Remote]
        public FieldCollection Fields
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("Fields", out obj2))
                {
                    return (FieldCollection) obj2;
                }
                FieldCollection fields = new FieldCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "Fields"));
                base.ObjectData.ClientObjectProperties["Fields"] = fields;
                return fields;
            }
        }

        [Remote]
        public FolderCollection Folders
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("Folders", out obj2))
                {
                    return (FolderCollection) obj2;
                }
                FolderCollection folders = new FolderCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "Folders"));
                base.ObjectData.ClientObjectProperties["Folders"] = folders;
                return folders;
            }
        }

        [Remote]
        public Guid Id
        {
            get
            {
                base.CheckUninitializedProperty("Id");
                return (Guid) base.ObjectData.Properties["Id"];
            }
        }

        [Remote]
        public uint Language
        {
            get
            {
                base.CheckUninitializedProperty("Language");
                return (uint) base.ObjectData.Properties["Language"];
            }
        }

        [Remote]
        public DateTime LastItemModifiedDate
        {
            get
            {
                base.CheckUninitializedProperty("LastItemModifiedDate");
                return (DateTime) base.ObjectData.Properties["LastItemModifiedDate"];
            }
        }

        [Remote]
        public ListCollection Lists
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("Lists", out obj2))
                {
                    return (ListCollection) obj2;
                }
                ListCollection lists = new ListCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "Lists"));
                base.ObjectData.ClientObjectProperties["Lists"] = lists;
                return lists;
            }
        }

        [Remote]
        public ListTemplateCollection ListTemplates
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("ListTemplates", out obj2))
                {
                    return (ListTemplateCollection) obj2;
                }
                ListTemplateCollection templates = new ListTemplateCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "ListTemplates"));
                base.ObjectData.ClientObjectProperties["ListTemplates"] = templates;
                return templates;
            }
        }

        [Remote]
        public Microsoft.SharePoint.Client.Navigation Navigation
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("Navigation", out obj2))
                {
                    return (Microsoft.SharePoint.Client.Navigation) obj2;
                }
                Microsoft.SharePoint.Client.Navigation navigation = new Microsoft.SharePoint.Client.Navigation(base.Context, new ObjectPathProperty(base.Context, base.Path, "Navigation"));
                base.ObjectData.ClientObjectProperties["Navigation"] = navigation;
                return navigation;
            }
        }

        [Remote]
        public bool QuickLaunchEnabled
        {
            get
            {
                base.CheckUninitializedProperty("QuickLaunchEnabled");
                return (bool) base.ObjectData.Properties["QuickLaunchEnabled"];
            }
            set
            {
                base.ObjectData.Properties["QuickLaunchEnabled"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "QuickLaunchEnabled", value));
                }
            }
        }

        [Remote]
        public bool RecycleBinEnabled
        {
            get
            {
                base.CheckUninitializedProperty("RecycleBinEnabled");
                return (bool) base.ObjectData.Properties["RecycleBinEnabled"];
            }
        }

        [Remote]
        public RoleDefinitionCollection RoleDefinitions
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("RoleDefinitions", out obj2))
                {
                    return (RoleDefinitionCollection) obj2;
                }
                RoleDefinitionCollection definitions = new RoleDefinitionCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "RoleDefinitions"));
                base.ObjectData.ClientObjectProperties["RoleDefinitions"] = definitions;
                return definitions;
            }
        }

        [Remote]
        public Folder RootFolder
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("RootFolder", out obj2))
                {
                    return (Folder) obj2;
                }
                Folder folder = new Folder(base.Context, new ObjectPathProperty(base.Context, base.Path, "RootFolder"));
                base.ObjectData.ClientObjectProperties["RootFolder"] = folder;
                return folder;
            }
        }

        [Remote]
        public string ServerRelativeUrl
        {
            get
            {
                base.CheckUninitializedProperty("ServerRelativeUrl");
                return (string) base.ObjectData.Properties["ServerRelativeUrl"];
            }
            set
            {
                if (base.Context.ValidateOnClient && (value == null))
                {
                    throw ClientUtility.CreateArgumentNullException("value");
                }
                base.ObjectData.Properties["ServerRelativeUrl"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "ServerRelativeUrl", value));
                }
            }
        }

        [Remote]
        public bool ShowUrlStructureForCurrentUser
        {
            get
            {
                base.CheckUninitializedProperty("ShowUrlStructureForCurrentUser");
                return (bool) base.ObjectData.Properties["ShowUrlStructureForCurrentUser"];
            }
        }

        [Remote]
        public GroupCollection SiteGroups
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("SiteGroups", out obj2))
                {
                    return (GroupCollection) obj2;
                }
                GroupCollection groups = new GroupCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "SiteGroups"));
                base.ObjectData.ClientObjectProperties["SiteGroups"] = groups;
                return groups;
            }
        }

        [Remote]
        public List SiteUserInfoList
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("SiteUserInfoList", out obj2))
                {
                    return (List) obj2;
                }
                List list = new List(base.Context, new ObjectPathProperty(base.Context, base.Path, "SiteUserInfoList"));
                base.ObjectData.ClientObjectProperties["SiteUserInfoList"] = list;
                return list;
            }
        }

        [Remote]
        public bool SyndicationEnabled
        {
            get
            {
                base.CheckUninitializedProperty("SyndicationEnabled");
                return (bool) base.ObjectData.Properties["SyndicationEnabled"];
            }
            set
            {
                base.ObjectData.Properties["SyndicationEnabled"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "SyndicationEnabled", value));
                }
            }
        }

        [Remote]
        public string Title
        {
            get
            {
                base.CheckUninitializedProperty("Title");
                return (string) base.ObjectData.Properties["Title"];
            }
            set
            {
                if ((base.Context.ValidateOnClient && (value != null)) && (value.Length > 0xff))
                {
                    throw ClientUtility.CreateArgumentException("value");
                }
                base.ObjectData.Properties["Title"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "Title", value));
                }
            }
        }

        [Remote]
        public bool TreeViewEnabled
        {
            get
            {
                base.CheckUninitializedProperty("TreeViewEnabled");
                return (bool) base.ObjectData.Properties["TreeViewEnabled"];
            }
            set
            {
                base.ObjectData.Properties["TreeViewEnabled"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "TreeViewEnabled", value));
                }
            }
        }

        [Remote]
        public int UIVersion
        {
            get
            {
                base.CheckUninitializedProperty("UIVersion");
                return (int) base.ObjectData.Properties["UIVersion"];
            }
            set
            {
                base.ObjectData.Properties["UIVersion"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "UIVersion", value));
                }
            }
        }

        [Remote]
        public bool UIVersionConfigurationEnabled
        {
            get
            {
                base.CheckUninitializedProperty("UIVersionConfigurationEnabled");
                return (bool) base.ObjectData.Properties["UIVersionConfigurationEnabled"];
            }
            set
            {
                base.ObjectData.Properties["UIVersionConfigurationEnabled"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "UIVersionConfigurationEnabled", value));
                }
            }
        }

        [Remote]
        public UserCustomActionCollection UserCustomActions
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("UserCustomActions", out obj2))
                {
                    return (UserCustomActionCollection) obj2;
                }
                UserCustomActionCollection actions = new UserCustomActionCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "UserCustomActions"));
                base.ObjectData.ClientObjectProperties["UserCustomActions"] = actions;
                return actions;
            }
        }

        [Remote]
        public WebCollection Webs
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("Webs", out obj2))
                {
                    return (WebCollection) obj2;
                }
                WebCollection webs = new WebCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "Webs"));
                base.ObjectData.ClientObjectProperties["Webs"] = webs;
                return webs;
            }
        }

        [Remote]
        public WorkflowAssociationCollection WorkflowAssociations
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("WorkflowAssociations", out obj2))
                {
                    return (WorkflowAssociationCollection) obj2;
                }
                WorkflowAssociationCollection associations = new WorkflowAssociationCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "WorkflowAssociations"));
                base.ObjectData.ClientObjectProperties["WorkflowAssociations"] = associations;
                return associations;
            }
        }

        [Remote]
        public WorkflowTemplateCollection WorkflowTemplates
        {
            get
            {
                object obj2;
                if (base.ObjectData.ClientObjectProperties.TryGetValue("WorkflowTemplates", out obj2))
                {
                    return (WorkflowTemplateCollection) obj2;
                }
                WorkflowTemplateCollection templates = new WorkflowTemplateCollection(base.Context, new ObjectPathProperty(base.Context, base.Path, "WorkflowTemplates"));
                base.ObjectData.ClientObjectProperties["WorkflowTemplates"] = templates;
                return templates;
            }
        }
    }
}

